
/**
 * @name Mashina.Module
 * @desc base module class, father of all Mashina modules
 * @extend Mashina.Class
 */
Mashina.Module = Mashina.Class.extend({
	/**
	 * @name Mashina.Module.prototype.initialize
	 * @desc create jsonEncoder
	 * @param Object o This object is used to dynamically extend the object at
	 * runtime. The parameter is optional.
	 */
	initialize: function (o) {
		this.jsonE = new Mashina.Encoder['::JSON'];
		
		this.extend(this, o);
		
		arguments.callee.$.initialize.call(this);
	},
	/**
	 * @name Mashina.Module.prototype.pack
	 * @desc pack the module into a self-contained object. You can provide any
	 * number of parameters. Each parameter is used to extract member objects.
	 */
	pack: function () {
		if (!arguments.length) {
			var args = [];
			
			for (var i in this)
				args.push(i);
		} else
			var args = arguments;
		
		var obj = {};
		
		for (var i = 0; i < args.length; i++)
			obj[args[i]] = this[args[i]];
				
		return obj;
	},
	/**
	 * @name Mashina.Module.prototype.packS
	 * @desc pack the module into a self-contained object string. You can
	 * provide any number of parameters. Each parameter is used to extract
	 * member objects.
	 */
	packS: function () {
		return this.jsonE.encode(this.pack.apply(this, arguments));
	},
	/**
	 * @name Mashina.Module.prototype.extend
	 * @desc extend object with another object
	 * @param Object dest the destionation object
	 * @param Object source the source object
	 */
	extend: function (dest, source) {
		for (var i in source)
			dest[i] = source[i];
	},
	/**
	 * @name Mashina.Module.prototype.log
	 * @desc log a message. The function excepets any number of parameters.
	 */
	log: function () {
		throw 'not implemented error';
	}
});

/**
 * @name Mashina.Util
 * @desc base util class, father of all utils
 * @extend Mashina.Module 
 */
Mashina.Util = Mashina.Module.extend();

/**
 * @name Mashina.Exploit
 * @desc base exploit class, father of all exploits
 * @extend Mashina.Module
 */
Mashina.Exploit = Mashina.Module.extend({
	/**
	 * @name Mashina.Exploit.prototype.run
	 * @desc start the exploit
	 */
	run: function () {
		throw 'not implemented error';
	},
	/**
	 * @name Mashina.Exploit.prototype.check
	 * @desc check whether the target is vulnerable
	 */
	check: function () {
		throw 'not implemented error';
	}
});

/**
 * @name Mashina.Payload
 * @desc the payload base class, father of all payloads
 * @extend Mashina.Class
 */
Mashina.Payload = Mashina.Class.extend({
	/**
	 * @name Mashina.Payload.prototype.generate
	 * @desc generate a payload
	 */
	generate: function () {
		throw 'not implemented error';
	}
});

/**
 * @name Mashina.Parser
 * @desc the parser base class, father of all parsers
 * @extend Mashina.Class
 */
Mashina.Parser = Mashina.Class.extend({
	/**
	 * @name Mashina.Parser.prototype.parse
	 * @desc parse
	 */
	parse: function () {
		throw 'not implemented error';
	},
	/**
	 * @name Mashina.Parser.prototype.build
	 * @desc build
	 */
	build: function () {
		throw 'not implemented error';
	}
});

/**
 * @name Mashina.Encoder
 * @desc the encoder base class, father of all encoders
 * @extend Mashina.Util
 */
Mashina.Encoder = Mashina.Class.extend({
	/**
	 * @name Mashina.Encoder.prototype.encode
	 * @desc encode
	 */
	encode: function () {
		throw 'not implemented error';
	},
	/**
	 * @name Mashina.Encoder.prototype.decode
	 * @desc decode
	 */
	decode: function () {
		throw 'not implemented error';
	}
});